/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.ui.dialogs;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
import org.eclipse.uml2.uml.UMLFactory;

import com.cea.papyrus.core.utils.Debug;


/**
 * 
 */
public class UnlimitedNaturalDialog extends ValueSpecificationDialog{
	
	
	
	/**
	 * 
	 * 
	 * @param parentShell 
	 */
	public UnlimitedNaturalDialog(Shell parentShell){
		super(parentShell);
		Debug.debug(this,"UnlimitedNaturalDialog", channel);
		announce="Create a literalInteger";
		
	}
	
	/**
	 * 
	 * 
	 * @param parent 
	 * 
	 * @return 
	 */
	@Override
	protected Control createDialogArea(Composite parent){
		Composite comp=(Composite)super.createDialogArea(parent);
		return comp;
	}
	
	/**
	 * 
	 * 
	 * @param parent 
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent){
		super.createButtonsForButtonBar(parent);
		
	}
	
	/**
	 * 
	 * 
	 * @param buttonId 
	 */
	@Override
	protected void buttonPressed(int buttonId){
		super.buttonPressed(buttonId);
	}
	
	/**
	 * 
	 */
	@Override
	protected void okPressed(){
		
		
		Debug.debug(this,"action..."+nameField.getText(), channel);
		value=UMLFactory.eINSTANCE.createLiteralUnlimitedNatural();
		Debug.debug(this,"value: "+value, channel);
		if ((nameField.getText().trim())==""){
			value=null;
		}
		else{
		((LiteralUnlimitedNatural)value).setValue(new Integer(nameField.getText()));
		}
		super.okPressed();
	}

	/**
	 * 
	 * 
	 * @return 
	 */
	@Override
	public Object getValue(){
		return value;
	}
}
